import dmPython

conn = None
cursor = None

def get_conn():
    global conn
    global cursor
    conn=dmPython.connect(user='SYSDBA',password='SYSDBA123',server= '172.18.142.1',port=5236)
    cursor = conn.cursor()


def create_table():
    get_conn()
    cursor.execute('''create table if not exists movie_boxoffice.test(
    id int primary key auto_increment,
    title varchar(100),
    score decimal(2,1),
    release_date varchar(10)
    )''')

def insert_datas(dataList):
    get_conn()
    cursor.executemany('''insert into movie_boxoffice.test (title,score ,release_date) values (?,?,?)''',dataList)
    cursor.execute('commit')


if __name__ == '__main__':
    get_conn()
    create_table()

    cursor.close()
    conn.close()




#
# values = cursor.fetchall()
# print(values)
